﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Wpf_Examples.Views;

namespace Wpf_Examples.ViewModels
{
    public class LanguageChangeViewModel:ObservableObject
    {

        public RelayCommand<string> ButtonClickCmd { get; set; }

        public LanguageChangeViewModel() {
            ButtonClickCmd = new RelayCommand<string>(FunMenu);
        }

        private void FunMenu(string obj)
        {
            var mainWindowInstance = App.Current.MainWindow; // 获取主窗口实例
            switch (obj)
            {
                case "设置":
                    PopWindow(new SettingWindow());
                    break;
            }
        }

        private void PopWindow(Window window)
        {
            var mainWindowInstance = App.Current.MainWindow; // 获取主窗口实例
            window.Owner = mainWindowInstance;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
        }
    }
}
